package auctionhaus

import static org.junit.Assert.*
import org.junit.*
import org.junit.rules.ExpectedException;

class CustomerIntegrationTests {

	@Before
	void setUp() {
		// Setup logic here
	}

	@After
	void tearDown() {
		// Tear down logic here
	}
	//C-2: Email address must be a unique field (integration test)
	@Test(expected = grails.validation.ValidationException.class)
	void testEmailAddressesUnique() {
		Customer custOne = new Customer(emailAddress:"bill@espn.com",password:"thispass")
		Customer custTwo = new Customer(emailAddress:"bill@espn.com",password:"thatpass")
		assertTrue(custOne.validate(['emailAddress']));
		assertNotNull(custOne.save(flush:true));
		assertFalse(custTwo.validate(['emailAddress']));
		assertNull(custTwo.save(flush:true, failOnError:true));
	}
}
